package ajaxTestSuite;

import com.thoughtworks.selenium.SeleneseTestCase;

public class ValidatorCallout extends SeleneseTestCase{
	@Override
	public void setUp() throws Exception {
		setUp("http://www.asp.net/", "*firefox");
		selenium.setSpeed("1000");
	}
	
	public void testValidatorCallout() throws Exception {
		selenium.open("/ajax/ajaxcontroltoolkit/Samples/Default.aspx");
		selenium.waitForPageToLoad("30000");
		selenium.click("id=ctl00_SamplesLinks_ctl40_SamplesLink");
		selenium.waitForPageToLoad("30000");
		selenium.type("id=ctl00_SampleContent_NameTextBox", "value");
		selenium.type("id=ctl00_SampleContent_PhoneNumberTextBox", "value");
		selenium.click("id=ctl00_SampleContent_Button1");
		selenium.click("xpath=/html/body/form[@id='aspnetForm']/table[@id='ctl00_SampleContent_PNReqEx_popupTable']/tbody/tr/td[4]/div");
		assertFalse(selenium.isVisible("xpath=/html/body/form[@id='aspnetForm']/table[@id='ctl00_SampleContent_PNReqEx_popupTable']/tbody/tr/td[2]"));
		
		selenium.type("id=ctl00_SampleContent_NameTextBox", "value");
		selenium.type("id=ctl00_SampleContent_PhoneNumberTextBox", "(111)111-4444");
		selenium.click("id=ctl00_SampleContent_Button1");
		assertTrue(selenium.isElementPresent("id=ctl00_SampleContent_lblMessage"));
		assertEquals(selenium.getText("id=ctl00_SampleContent_lblMessage"), "Thanks value, we'll give you a call at (111)111-4444.");
	}
}
